package dao.auth.mybatis;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import model.auth.Roles;

import org.springframework.stereotype.Repository;

import core.base.page.Page;
import core.base.page.PageRequest;
import dao.MyBatisBaseDao;
import dao.auth.RolesDao;

@Repository("auth.RolesDao")
public class RolesDaoImpl extends MyBatisBaseDao implements RolesDao {

	public int deleteById(Long id) {
		return getSqlSessionTemplate().delete("auth.RolesMapper.deleteById", id);
	}

	public Roles getById(Long id) {
		return (Roles) getSqlSessionTemplate().selectOne("auth.RolesMapper.getById", id);
	}

	public int insert(Roles model) {
		return getSqlSessionTemplate().insert("auth.RolesMapper.insert", model);
	}

	public List<Roles> queryByProperties(Map filter) {
		return getSqlSessionTemplate().selectList("auth.RolesMapper.queryByProperties", filter);
	}

	public Page<Roles> queryForPage(PageRequest<Map> pageReq) {
		return super.queryForPage(pageReq, "auth.RolesMapper.queryForPage");
	}

}
